<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2022/10/1
  Time: 19:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>图书管理系统</title>
</head>
<body>
<h1 align="center">书籍库</h1>
<div>
  <div style="float: left">
<form action="${pageContext.request.contextPath}/addbookscommit" method="post">
  <p>书籍:<input type="text" name="name"><p>
  <p> 价格：<input type="text" name="price"><p>
  <p> 数量：<input type="number" name="amount"><p>
  <p><input type="submit" value="增加"><p>
</form>
  </div>
  <div style="float: left">
<table border="1" cellpadding="0" cellspacing="0" width="300" height="50" align="center">
  <tr>
    <td>id</td>
    <td>书名</td>
    <td>价格</td>
    <td>数量</td>
    <td>删除</td>
    <td>更新</td>
  </tr>
  <c:forEach var="books" items="${BooksList}">
    <tr>
      <td>${books.id}</td>
      <td>${books.name}</td>
      <td>${books.price}</td>
      <td>${books.amount}</td>
      <td>
        <a href="${pageContext.request.contextPath}/deletebooks?id=${books.id}">删除</a>
      </td>
      <td>
        <a href="${pageContext.request.contextPath}/updatabooks?id=${books.id}&name=${books.name}&price=${books.price}&amount=${books.amount}">更新</a>
      </td>
    </tr>
  </c:forEach>
</table>
  </div>
  <div style="float: left">
  <form action="${pageContext.request.contextPath}/updatabookscommit" method="post">
    <p>id:<input type="text" name="id" value="${id}" ><p>
    <p> 书名：<input type="text" name="name" value="${name}"><p>
    <p>价格:<input type="text" name="price" value="${price}"><p>
    <p>数量:<input type="text" name="amount" value="${amount}"><p>
    <p><input type="submit" value="修改"><p>
  </form>
  </div>
</div>
</body>
</html>
